import {user_login} from "@/utils/index"
const users={
    namespaced: true,
    state:{
       userInfo:JSON.parse(window.localStorage.getItem('token'))||{}

    },
    getters: {
    },
    mutations: {
        set_userInfo(state,payload){
            console.log("111",payload);
            state.userInfo=payload.token
            window.localStorage.setItem("token",JSON.stringify(state.userInfo))
        }
    },
    actions: {
        async get_token({commit},values){
            let {data}=await user_login(values)
            console.log(data);
            commit("set_userInfo",data)
        }
    },
    modules: {
    },
}
export default users